package com.company.cloud.user.modules.api.fallback;

import com.company.cloud.common.bean.BaseClientResult;
import com.company.cloud.user.modules.api.response.TeamSimpleModel;
import com.company.cloud.user.modules.api.response.UserFull;
import com.company.cloud.user.modules.api.response.UserSimple;
import com.company.cloud.user.modules.api.service.UserRemoteService;
import feign.hystrix.FallbackFactory;
import lombok.extern.log4j.Log4j2;
import org.springframework.stereotype.Component;

import java.util.List;
import java.util.Map;
import java.util.Set;

@Log4j2
@Component
public class UserRemoteServiceFallbackFactory implements FallbackFactory<UserRemoteService>{

	@Override
	public UserRemoteService create(Throwable cause) {
		return new UserRemoteService() {

			@Override
			public BaseClientResult<UserSimple> getUserById(Integer id) {
				log.debug("++++++ UserRemoteService.getUserById Fallback Error!");
				return BaseClientResult.callbackError();
			}

			@Override
			public BaseClientResult<List<UserSimple>> getUserListByIds(String ids) {
				log.debug("++++++ UserRemoteService.getUserListByIds Fallback Error!");
				return BaseClientResult.callbackError();
			}

			@Override
			public BaseClientResult<List<UserSimple>> getUserListByIds(Set<Integer> ids) {
				return BaseClientResult.callbackError();
			}

			@Override
			public BaseClientResult<Map<Integer, UserSimple>> getUserMapByIds(String ids) {
				return BaseClientResult.callbackError();
			}

			@Override
			public BaseClientResult<Map<Integer, UserSimple>> getUserMapByIds(Set<Integer> ids) {
				return BaseClientResult.callbackError();
			}

			@Override
			public BaseClientResult<UserFull> getFullUserById(Integer id) {
				return BaseClientResult.callbackError();
			}

			@Override
			public BaseClientResult<UserSimple> getUserByShareCode(String shareCode) {
				return BaseClientResult.callbackError();
			}

			@Override
			public BaseClientResult<Map<Integer, UserSimple>> getUserByShareCodes(Set<String> shareCodes) {
				return BaseClientResult.callbackError();
			}

			@Override
			public BaseClientResult<UserSimple> getUserByCustCode(String custCode) {
				return BaseClientResult.callbackError();
			}

			@Override
			public BaseClientResult<TeamSimpleModel> getTeamSimpleModel(Integer userId) {
				return BaseClientResult.callbackError();
			}

		};
	}

}
